using System.Data;
using Admin2025.Application;
using Admin2025.Infrastructure;
using Microsoft.Data.SqlClient;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

// 注册基础设施服务
builder.Services.AddInfrastructure(builder.Configuration);
// 注册了AuthService服务
builder.Services.AddApplication();

builder.Services.AddScoped<IDbConnection>(sp =>
{
  var configuration = sp.GetRequiredService<IConfiguration>();
  var connStr = configuration.GetConnectionString("Dapper");
  return new SqlConnection(connStr);
});

var app = builder.Build();

app.MapControllers();

app.Run();


